package com.cupdata.sms.core;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.kafka.common.protocol.types.Field;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: zda
 * @description: TODO
 * @date: 2024/5/6 14:43
 */
@Data
@Builder
@NoArgsConstructor
public class CusKafkaProperties {
    private String topicName;
    private String groupId;
    private int durationMs;
    private Boolean needIdempotence;
    private int idempotenceSize;
    private Map<String,Object> otherProps;

    public CusKafkaProperties(String topicName, String groupId, int durationMs, Boolean needIdempotence,int idempotenceSize, Map<String, Object> otherProps) {
        this.topicName = topicName;
        this.groupId = groupId;
        this.durationMs=durationMs==0?1000:durationMs;
        this.needIdempotence=needIdempotence==null?true:needIdempotence;
        this.idempotenceSize=idempotenceSize==0?10000:idempotenceSize;
        this.otherProps=otherProps==null?new HashMap<>():otherProps;
    }
}
